package com.leen.user.service.impl;

import com.leen.user.service.CrudService;
import org.springframework.data.repository.CrudRepository;

public class CrudServiceImpl<T,ID> implements CrudService<T,ID> {


    private CrudRepository crudRepository;

    public void setCrudRepository(CrudRepository crudRepository) {
        this.crudRepository = crudRepository;
    }
    @Override
    public <S extends T> S save(S entity) {

        return (S) this.crudRepository.save(entity);
    }

    @Override
    public void deleteById(ID id) {
        this.crudRepository.deleteById(id);
    }

    @Override
    public Iterable<T> findAll() {
        return this.crudRepository.findAll();
    }
}
